import React from 'react';
import  '../../public/css/logmanage.css';
import { inject, observer } from 'mobx-react';
import { Input } from 'antd';
import { Select } from 'antd';
import { Table, Icon, Divider } from 'antd';

const Search = Input.Search;
const Option = Select.Option;

function handleChange(value) {
    console.log(`selected ${value}`);
  }

const columns = [{
    title: '用户名',
    dataIndex: 'realName',
    key: 'realName',
}, {
    title: '余额',
    dataIndex: 'pre_balance',
    key: 'pre_balance',
}, {
    title: '描述',
    dataIndex: 'description',
    key: 'description',
},{
    title: '操作时间',
    dataIndex: 'create_time',
    key: 'create_time',
}];

@inject('logManage')
@observer
export default class LogManage extends React.Component {
    componentDidMount() {
        // console.log(this.props)
        this.props.logManage.getTransData()
    }
    handelTableChange(pagination, filters, sorter){
        this.props.logManage.param.pagenow=pagination.current
        this.props.logManage.pagination=pagination
        this.props.logManage.getTransData()
    }
    handleChange(val){
        console.log(val)
        this.props.logManage.param.action_type=val
        this.props.logManage.param.pagenow=this.props.logManage.pagination.current=1
        this.props.logManage.getTransData()
    }
    render(){
        const {tableData,pagination}=this.props.logManage
        return (
            <div className="clearfix bgwh log-manage">
                <div className="up">
                    <span className="f18 fwb">日志管理</span>
                    <Select className="fr ml-10" defaultValue="充值" style={{ width: 160 }} onChange={this.handleChange.bind(this)}>
                        <Option value="0">充值</Option>
                        <Option value="1">订购套餐费</Option>
                        <Option value="2">订购冻结</Option>
                        <Option value="3">接口服务余额扣费</Option>
                        <Option value="4">接口服务冻结扣费</Option>
                        <Option value="5">接口服务结算扣费</Option>
                        <Option value="6">解冻</Option>
                        <Option value="7">呼叫批价</Option>
                    </Select>
                </div>
                <Table className="down"
                    columns={columns}
                    dataSource={tableData.slice()}
                    rowKey="id"
                    loading={false}
                    pagination={pagination}
                    onChange={this.handelTableChange.bind(this)}
                    />
            </div>
        )
    }
}